#ifndef SUBSTATION_H
#define SUBSTATION_H

#include <string>
#include <vector>

#include "Physical/pwrPlant.h"

/**
  * class subStation
  * This is a substation that is chiefly a NODE for all other objects to connect
  * together within the regional utilities network.
  * Future: include systems (fault control, etc.) within substation (the
  * real life kind) and more!
  */
namespace physical
{

//class pwrPlant;

class subStation : protected property
{

public:     // Constructors/Destructors

    /**
     * Empty Constructor
     */
    subStation ( );

    /**
     * Constructor
     * @param  lattitude Lattitude of the station.
     * @param  longitude Longitude of the station
     */
    subStation (double lattitude = -1.00, double longitude = -1.00 );

    /**
     * Empty Destructor
     */
    virtual ~subStation ( );


public:     // Public general methods

    /**
     * Connects a power plant object to the station (creates pointer from station to
     * power plant object). Returns TRUE if successful, else FALSE.
     * @return bool
     * @param  pwrPlant ptr to power plant object
     */
    bool connectPwrPlant ( property* pwrPlantLink );

    /**
     * Disconnects a power plant object to the station (destroys pointer from station
     * to power plant object). Returns TRUE if successful, else FALSE.
     * @return bool
     * @param  pwrPlant Ptr to power plant object.
     */
    bool disconnectPwrPlant ( );

    /**
     * Connects a load object to the station (creates pointer from station to load
     * object). Returns TRUE if successful, else FALSE.
     * @return bool
     * @param  load ptr to load object
     */
    //bool connectLoad (load* load = NULL );

    /**
     * Disconnects a load object to the station (destroys pointer from station to load
     * object). Returns TRUE if successful, else FALSE.
     * @return bool
     * @param  load ptr to load object
     */
    //bool disconnectLoad (load* load = NULL );

    /**
     * Connects a transmission line object to the station (creates pointer from station
     * to transmission line object). Returns TRUE if successful, else FALSE.
     * @return bool
     * @param  line
     */
    //bool connectLine (transLine* line = NULL );

    /**
     * Disconnects a transmission line object to the station (destroys pointer from
     * station to transmission line object). Returns TRUE if successful, else FALSE.
     * @return bool
     * @param  line ptr to line object
     */
    //bool disconnectLine (transLine* line = NULL );

    /**
     * @return bool
     * @param  localNetwork
     */
    //bool joinLocalNet (localNetwork* localNetwork = NULL );

    /**
     * @return bool
     */
    //bool quitLocalNet ( );

    /**
     * @return bool
     * @param  localNetwork
     */
    //bool changeLocalNet (localNetwork* localNetwork = NULL );

    /**
     * @return bool
     * @param  regionalNetwork
     */
    //bool joinRegionalNet (regionNetwork* regionalNetwork = NULL );

    /**
     * @return bool
     */
    //bool quitRegionalNet ( );

    /**
     * @return bool
     * @param  regionalNetwork
     */
    //bool changeRegionalNet (regionNetwork* regionalNetwork = NULL );


private:     // Private attribute accessor methods

    /**
     * Get the value of SUBSTATION_COUNT
     * @return the value of SUBSTATION_COUNT
     */
    unsigned long getSUBSTATION_COUNT ( );


private:        // Private attribute accessor methods

    /**
     * Set the value of numPwrPlants
     * Number of power plants connected to the station.
     * @param new_var the new value of numPwrPlants
     */
    void setNumPwrPlants ( int new_var = 0 );

    /**
     * Get the value of numPwrPlants
     * Number of power plants connected to the station.
     * @return the value of numPwrPlants
     */
    int getNumPwrPlants ( );

    /**
     * Set the value of pwrPlant
     * Pointer to power plant object.
     * @param new_var the new value of pwrPlant
     */
    void setPwrPlant ( property* new_var = NULL );

    /**
     * Get the value of pwrPlant
     * Pointer to power plant object.
     * @return the value of pwrPlant
     */
    property* getPwrPlant ( );

    /**
     * Set the value of numLoads
     * Number of loads connected to the station.
     * @param new_var the new value of numLoads
     */
    //void setNumLoads ( int new_var );

    /**
     * Get the value of numLoads
     * Number of loads connected to the station.
     * @return the value of numLoads
     */
    //int getNumLoads ( );

    /**
     * Set the value of load
     * Pointer to the load object.
     * @param new_var the new value of load
     */
    //void setLoad ( load* new_var );

    /**
     * Get the value of load
     * Pointer to the load object.
     * @return the value of load
     */
    //load* getLoad ( );

    /**
     * Set the value of numLines
     * Number of transmittion lines connected to the station.
     * @param new_var the new value of numLines
     */
    //void setNumLines ( int new_var );

    /**
     * Get the value of numLines
     * Number of transmittion lines connected to the station.
     * @return the value of numLines
     */
    //int getNumLines ( );

    /**
     * Set the value of line
     * Pointer to the transmission line object.
     * @param new_var the new value of line
     */
    //void setLine ( transLine* new_var );

    /**
     * Get the value of line
     * Pointer to the transmission line object.
     * @return the value of line
     */
    //transLine* getLine ( );

    /**
     * Set the value of localNetwork
     * Pointer to local network object where the station is located.
     * @param new_var the new value of localNetwork
     */
    //void setLocalNetwork ( localNetwork* new_var );

    /**
     * Get the value of localNetwork
     * Pointer to local network object where the station is located.
     * @return the value of localNetwork
     */
    //localNetwork* getLocalNetwork ( );

    /**
     * Set the value of regionalNetwork
     * Pointer to regional network object where the station is located.
     * @param new_var the new value of regionalNetwork
     */
    //void setRegionalNetwork ( regionNetwork* new_var );

    /**
     * Get the value of regionalNetwork
     * Pointer to regional network object where the station is located.
     * @return the value of regionalNetwork
     */
    //regionNetwork* getRegionalNetwork ( );

    /**
     * Set the value of uniqueStationID
     * @param new_var the new value of uniqueStationID
     */
    void setUniqueStationID ( unsigned long new_var );

    /**
     * Get the value of uniqueStationID
     * @return the value of uniqueStationID
     */
    unsigned long getUniqueStationID ( );


    void initAttributes ( ) ;


private:        // Static Private attributes

    static unsigned long SUBSTATION_COUNT;

private:        // Private attributes

    int numPwrPlants;   // Number of power plants connected to the station.
    property* pwrPlantLink;// Pointer to power plant object.
    //int numLoads;       // Number of loads connected to the station.
    //load* loadLink;     // Pointer to the load object.
    //int numLines;       // Number of transmittion lines connected to the station.
    //transLine* lineLink;// Pointer to the transmission line object.
    //localNetwork* localNetworkLink;   // Pointer to local network object where the station is located.
    //regionNetwork* regionalNetworkLink;// Pointer to regional network object where the station is located.
    unsigned long uniqueStationID;
};

}; // end namespace physical

unsigned long physical::subStation::SUBSTATION_COUNT = 0;

#endif // SUBSTATION_H
